<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" th:href="@{~/css/style.css}">
    <link rel="stylesheet" th:href="@{/assets/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/assets/font-awesome/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{/assets/css/form-elements.css}">
    <link rel="stylesheet" th:href="@{/assets/css/style.css}">
    <script th:src="@{/js/sweetalert.min.js}"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/css/sweetalert.css}">
</head>
<body>
<div class="container" id="container">
<div>
    <form >
        <h1>找回密码</h1>
        <span>使用您的电子邮箱找回</span>
        <div>
            <input type="email" placeholder="邮箱" name="email" id="email">
            <a class="btn" id="sendMobileCode" >
                <span id="email_btn">获取</span>
            </a><br/>
            <input type="tel" placeholder="请输入验证码" name="code" id="code"><br/>
        </div>
<!--        <input type="text" placeholder="用户名" name="username" id="username">-->
        <input type="password" placeholder="密码" name="password" id="password"><br/>
        <input type="password" placeholder="再次输入密码" name="password2" id="password2"><br/>
        <input id="editpassword" type="button" value="确认"/>
    </form>
</div>
</div>
<script  th:src="@{~/js/script.js}"></script>
<script th:src="@{/assets/js/jquery-1.11.1.js}"></script>
<script th:src="@{/assets/bootstrap/js/bootstrap.min.js}"></script>
<script th:src="@{/assets/js/jquery.backstretch.min.js}"></script>
<script th:src="@{/assets/js/scripts.js}"></script>
<script>
    <!--邮箱发送验证码-->
$("#email_btn").click(function () {
    var email=$("#email").val();
    alert("请打开邮箱认真查找");
    $.ajax({
        type:"POST",
        url:"/users/setEmail",
        data:{"email":email}

    })
});
    $("#editpassword").click(function () {
       var email =$("#email").val();
       var password=$("#password").val();
       var password2=$("#password2").val();
       var code =$("#code").val();
       $.ajax({
           type:'post',
           url:"/users/getpassword",
           data:{
               password:password,
               password2:password2,
               email:email,
               code:code
           },
           success:function (data) {
               swal({
                    title:data.msg,
                   type:'success'
               });
           }
       });
    });
</script>
</body>
</html>